using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using VOL.Entity.DomainModels;

namespace VOL.demo.IServices.Outbound
{
    /// <summary>
    /// ���ⵥ����ӿ�
    /// </summary>
    public interface IOutboundIService
    {
        /// <summary>
        /// 获取出入库类型下拉列表
        /// </summary>
        /// <returns>出入库类型列表</returns>
        Task<List<InOutTypeDto>> GetInOutTypeListAsync();

        /// <summary>
        /// 获取仓库下拉列表
        /// </summary>
        /// <returns>仓库列表</returns>
        Task<List<WarehouseDto>> GetWarehouseListAsync();

        /// <summary>
        /// 获取用户下拉列表
        /// </summary>
        /// <returns>用户列表</returns>
        Task<List<UserDto>> GetUserListAsync();

        /// <summary>
        /// 根据出入库类型ID分页查询销售订单（多表联查）
        /// </summary>
        /// <param name="inOutTypeId">出入库类型ID</param>
        /// <param name="pageIndex">页码（从1开始）</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="orderCode">订单编号（可选）</param>
        /// <param name="customerName">客户名称（可选）</param>
        /// <returns>分页结果</returns>
        Task<(List<SalesOrderDto> Data, int TotalCount)> GetSalesOrderPageListAsync(
            long inOutTypeId,
            int pageIndex,
            int pageSize,
            string orderCode = null,
            string customerName = null);

        /// <summary>
        /// 根据出入库类型ID分页查询进货退货（多表联查）
        /// </summary>
        /// <param name="inOutTypeId">出入库类型ID</param>
        /// <param name="pageIndex">页码（从1开始）</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="returnOrderCode">退货单号（可选）</param>
        /// <param name="supplierName">供应商名称（可选）</param>
        /// <returns>分页结果</returns>
        Task<(List<ReturnOrderDto> Data, int TotalCount)> GetReturnOrderPageListAsync(
            long inOutTypeId,
            int pageIndex,
            int pageSize,
            string returnOrderCode = null,
            string supplierName = null);

        /// <summary>
        /// 根据销售订单ID查询销售订单明细（与货品表联查）
        /// </summary>
        /// <param name="shopOrderId">销售订单ID</param>
        /// <returns>销售订单明细列表</returns>
        Task<List<SalesOrderDetailDto>> GetSalesOrderDetailsByIdAsync(long shopOrderId);

        /// <summary>
        /// 根据退货订单ID查询退货订单明细（与进货明细表和货品表联查）
        /// </summary>
        /// <param name="returnOrderId">退货订单ID</param>
        /// <returns>退货订单明细列表</returns>
        Task<List<ReturnOrderDetailDto>> GetReturnOrderDetailsByIdAsync(long returnOrderId);

        /// <summary>
        /// 退货出库（事务性操作）
        /// </summary>
        /// <param name="request">退货出库请求</param>
        /// <returns>出库单ID</returns>
        Task<long> CreateReturnOutboundAsync(ReturnOutboundRequestDto request);

        /// <summary>
        /// 销售订单出库（事务性操作）
        /// </summary>
        /// <param name="request">销售订单出库请求</param>
        /// <returns>出库单ID</returns>
        Task<long> CreateSalesOutboundAsync(SalesOutboundRequestDto request);

        /// <summary>
        /// 分页查询出库单（多表联查）
        /// </summary>
        /// <param name="pageIndex">页码（从1开始）</param>
        /// <param name="pageSize">每页记录数</param>
        /// <param name="outboundCode">出库编号（可选）</param>
        /// <param name="userId">用户ID（可选）</param>
        /// <returns>分页结果</returns>
        Task<(List<OutboundDto> Data, int TotalCount)> GetPageListWithRelationsAsync(
            int pageIndex,
            int pageSize,
            string outboundCode = null,
            long? userId = null);
        /// <summary>
        /// 根据出库ID查询出库明细列表（多表联查）
        /// </summary>
        /// <param name="outboundId">出库单ID</param>
        /// <returns>出库明细列表</returns>
        Task<List<OutboundDetailDto>> GetOutboundDetailsByIdAsync(long outboundId);
    }
}
